@import '../../style/themes/default';
@import '../../style/mixins/index';

.@{c7n-prefix}-carousel {
  .reset-component;

  .slick-slider {
    position: relative;
    display: block;
    box-sizing: border-box;
    -webkit-touch-callout: none;
    -ms-touch-action: pan-y;
    touch-action: pan-y;
    -webkit-tap-highlight-color: transparent;
  }
  .slick-list {
    position: relative;
    display: block;
    margin: 0;
    padding: 0;
    overflow: hidden;

    &:focus {
      outline: none;
    }

    &.dragging {
      cursor: pointer;
    }
  }
  .slick-slider .slick-track,
  .slick-slider .slick-list {
    transform: translate3d(0, 0, 0);
  }

  .slick-track {
    position: relative;
    top: 0;
    left: 0;
    display: block;

    &::before,
    &::after {
      display: table;
      content: '';
    }

    &::after {
      clear: both;
    }

    .slick-loading & {
      visibility: hidden;
    }
    > :not([aria-hidden="false"]) {
      pointer-events: none;
    }
  }
  .slick-slide {
    display: none;
    float: left;
    height: 100%;
    min-height: 0.01rem;
    [dir='rtl'] & {
      float: right;
    }
    img {
      display: block;
    }
    &.slick-loading img {
      display: none;
    }

    &.dragging img {
      pointer-events: none;
    }
  }

  .slick-initialized .slick-slide {
    display: block;
  }

  .slick-loading .slick-slide {
    visibility: hidden;
  }

  .slick-vertical .slick-slide {
    display: block;
    height: auto;
    border: @border-width-base @border-style-base transparent;
  }
  .slick-arrow.slick-hidden {
    display: none;
  }

  // Arrows
  .slick-prev,
  .slick-next {
    position: absolute;
    top: 50%;
    display: block;
    width: 0.2rem;
    height: 0.2rem;
    margin-top: -0.1rem;
    padding: 0;
    color: transparent;
    font-size: 0;
    /* stylelint-disable-next-line font-family-no-missing-generic-family-keyword */
    font-family: icomoon;
    line-height: 0;
    background: @carousel-arrows-bg;
    border: 0;
    outline: none;
    cursor: pointer;
    &:hover {
      background: @carousel-arrows-hover-bg;
      outline: none;
      transform: scaleY(1.1);
      transition: transform @animation-duration-base;
      &::before {
        opacity: 1;
      }
    }
    &.slick-disabled::before {
      opacity: 0.25;
    }
  }

  .slick-prev {
    left: 0;
    z-index: 1;
    border-radius: 0 0.1rem 0.1rem 0;
    &::before {
      content: "\e408";
    }
  }

  .slick-next {
    right: 0;
    border-radius: 0.1rem 0 0 0.1rem;
    &::before {
      content: '\e409';
    }
  }

  .slick-vertical {
    .slick-prev,
    .slick-next {
      left: 50%;
      transform: rotate(90deg);
      transform-origin: left center;
      &:hover {
        transform: rotate(90deg) scaleY(1.1);
        transition: transform @animation-duration-base;
      }
    }
    .slick-prev {
      top: 0;
    }
    .slick-next {
      top: calc(100% - 0.2rem);
    }
  }

  .slick-next::before,
  .slick-prev::before {
    color: @icon-text-color;
    font-size: @carousel-icon-font-size;
    line-height: 1;
    opacity: 0.6;
    -webkit-font-smoothing: antialiased;
  }

  // Dots
  .slick-dots {
    position: absolute;
    bottom: 0.12rem;
    display: block;
    width: 100%;
    height: @carousel-dot-height;
    margin: 0;
    padding: @carousel-dot-padding;
    text-align: @carousel-dot-text-align;
    list-style: none;
    li {
      position: relative;
      display: inline-block;
      margin: 0 2px;
      padding: 0;
      text-align: center;
      vertical-align: top;
      button {
        display: block;
        width: @carousel-dot-width;
        height: @carousel-dot-height;
        padding: 0;
        color: transparent;
        font-size: 0;
        background: #fff;
        border: 0;
        border-radius: @carousel-dot-border-radius;
        outline: none;
        cursor: pointer;
        opacity: 0.3;
        transition: all 0.5s;
        &:hover,
        &:focus {
          opacity: 0.75;
        }
      }
      &.slick-active button {
        width: @carousel-dot-active-width;
        background: @carousel-dot-active-bg;
        opacity: 1;
        &:hover,
        &:focus {
          opacity: 1;
        }
      }
    }
  }
}

.@{c7n-prefix}-carousel-vertical {
  .slick-dots {
    top: 50%;
    right: 0.12rem;
    bottom: auto;
    width: @carousel-dot-height;
    height: auto;
    transform: translateY(-50%);
    li {
      margin: 0 2px;
      vertical-align: baseline;
      button {
        width: @carousel-dot-height;
        height: @carousel-dot-width;
      }
      &.slick-active button {
        width: @carousel-dot-height;
        height: @carousel-dot-active-width;
      }
    }
  }
}

.@{c7n-prefix}-carousel-theme-dark {
  .slick-next,
  .slick-prev {
    &:hover::before {
      color: @carousel-dark-color;
    }
  }
  .slick-next::before,
  .slick-prev::before {
    color: @text-color-secondary;
  }
  .slick-dots {
    li {
      button {
        background: @carousel-btn-bg;
        opacity: 0.45;
      }
      &.slick-active button {
        background: @carousel-dark-color;
      }
    }
  }
}
